#include "arithmetic.h"
#include <vector>

class Polygon
{
private:
   Point * polygon;
   int n;
public:
   Polygon(int n_): n(n_)
   {
      polygon = new Point[n];
   }

   void add_point(int i, Point p)
   {
      polygon[i] = p;
   }

   bool contains(Point & p)
   {
      for (int i = 0; i < n - 1; i++)
         if (left_turn(polygon[i], polygon[i + 1], p) == -1)
            return false;

      if (left_turn(polygon[n - 1], polygon[0], p) == -1)
         return false;
      return true;
   }
};

